const express = require('express');
const router = express.Router();

router.get('/', (req, res) => {
    const content = [];
    for(let i = 0; i < 100; i++)
        content.push({
            id: `string${i}`,
            code: `string${i}`,
            brandId: `string${i}`,
            brandCode: `string${i}`,
            dealerId: `string${i}`,
            dealerCode: `string${i}`,
            theme: `string${i}`,
            amount: 1000,
            currency: 1,
            status: 1,
            startTime: '2020-05-18T01:59:54.674Z',
            endTime: '2020-05-18T01:59:54.674Z',
            rowVersion: `string${i}`,
            options: [
                'update',
                'abandon',
                'submit',
                'takeEffect',
                'approve'
            ]
        });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 100,
        }
    });
});

router.get('/forMarketingActivityReports', (req, res) => {
    const content = [];
    for(let i = 0; i < 40; i++) content.push({
        id: `${i + 1}`,
        code: 'string',
        brandCode: 'string',
        dealerCode: 'string',
        theme: 'string',
        currency: 1,
        statDate: '2020-05-21T07:27:57.452Z',
        endDate: '2020-05-21T07:27:57.452Z',
        customerQTY: 1,
        amount: 1,
        details: [
            {
                id: '1',
                num: 1,
                item: 'string',
                amount: 'string',
                marketingActivityItemCategoryL1Id: 'string',
                marketingActivityItemCategoryL1Name: 'string',
                marketingActivityItemCategoryL2Id: 'string',
                marketingActivityItemCategoryL2Name: 'string'
            }
        ]
    });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 41,
        }
    });
});
router.get('/forMarketingActivityReports/simple', (req, res) => {
    const content = [];
    for(let i = 0; i < 10; i++)
        content.push({
            id: `2019${i}`,
            code: 'string',
            brandCode: 'string',
            dealerCode: 'string',
            theme: 'string',
            currency: 1,
            statDate: '2020-05-21T07:27:57.452Z',
            endDate: '2020-05-21T07:27:57.452Z',
            customerQTY: 1,
            amount: 1,
            details: [
                {
                    id: '1',
                    num: 1,
                    item: 'string',
                    amount: 'string',
                    marketingActivityItemCategoryL1Id: 'string',
                    marketingActivityItemCategoryL1Name: 'string',
                    marketingActivityItemCategoryL2Id: 'string',
                    marketingActivityItemCategoryL2Name: 'string'
                }
            ]
        });
    res.json({
        message: '',
        payload: {
            content
        }
    });
});
router.get('/:id', (req, res) => {
    res.json({
        message: '',
        payload: {
            id: '17281534-df9f-4644-bd21-08d7fbd2164c',
            rowVersion: 'AAAAAAELXVE=',
            code: 'MA1566520200502',
            brandId: '305d091e-3a99-43e0-14dd-08d76bf076c5',
            brandCode: 'CHERY',
            brandName: 'CHERY',
            statDate: '2020-05-19T16:02:06.304+08:00',
            endDate: '2021-05-19T16:02:06.304+08:00',
            theme: '测试主题001',
            background: '测试背景001',
            amount: 60,
            currency: 1,
            mainItem: [
                1,
                2
            ],
            mainItemRemark: '测试备注001',
            customerQTY: 2,
            vehicleWarranty: '测试车辆政策001',
            scope: '测试营销目标001',
            content: '测试营销内容001',
            isReport: false,
            status: 1,
            isAllowApprove: false,
            nextNumber: 1,
            isDealer: true,
            options: [
                'update',
                'abandon',
                'report'
            ],
            marketingProduct: [
                {
                    id: '11bd4d0d-17a5-4658-bc90-08d7fbd21660',
                    productCategoryId: 'd040c509-7d20-4afc-8b1b-0650add1975b',
                    productCategoryCode: 'B16',
                    productCategoryName: 'B16'
                },
                {
                    id: '85b59e0a-a014-406e-bc91-08d7fbd21660',
                    productCategoryId: '3f92e7dd-8174-45b6-afe3-088dadf78aea',
                    productCategoryCode: 'Q22',
                    productCategoryName: 'Q22'
                }
            ],
            activityTarget: [
                {
                    id: 'e9d480e4-6d30-4053-e450-08d7fbd21661',
                    type: 1,
                    lastData: 2,
                    estimateData: 2,
                    proportion: 2
                },
                {
                    id: '55e47d77-5573-4997-e451-08d7fbd21661',
                    type: 2,
                    lastData: 3,
                    estimateData: 3,
                    proportion: 3
                },
                {
                    id: '3ab83def-a431-43e9-e452-08d7fbd21661',
                    type: 3,
                    lastData: 4,
                    estimateData: 4,
                    proportion: 4
                }
            ],
            activityItems: [
                {
                    id: '4660b8e4-5df3-49a2-8e7d-08d7fbd2165c',
                    marketingActivityId: '17281534-df9f-4644-bd21-08d7fbd2164c',
                    marketingActivityItemCategoryId: '3ca5c6be-5b53-43e5-8030-529a4664a1d4',
                    marketingActivityItemCategoryCode: 'A0101',
                    marketingActivityItemCategoryName: 'TV',
                    parentMarketingActivityItemCategoryId: '1ac0e64b-5458-4e92-83a4-9760175e5147',
                    parentMarketingActivityItemCategoryCode: 'A01',
                    parentMarketingActivityItemCategoryName: 'AD',
                    item: '测试项目001',
                    amount: 10,
                    remark: '测试项目备注001'
                },
                {
                    id: '70e8d878-8b66-4ac1-8e7e-08d7fbd2165c',
                    marketingActivityId: '17281534-df9f-4644-bd21-08d7fbd2164c',
                    marketingActivityItemCategoryId: '1ac0e64b-5458-4e92-83a4-9760175e5147',
                    marketingActivityItemCategoryCode: 'A01',
                    marketingActivityItemCategoryName: 'AD',
                    parentMarketingActivityItemCategoryId: '00000000-0000-0000-0000-000000000000',
                    parentMarketingActivityItemCategoryCode: null,
                    parentMarketingActivityItemCategoryName: null,
                    item: '测试项目002',
                    amount: 20,
                    remark: '测试项目备注002'
                },
                {
                    id: '2cf79339-3364-4cae-8e7f-08d7fbd2165c',
                    marketingActivityId: '17281534-df9f-4644-bd21-08d7fbd2164c',
                    marketingActivityItemCategoryId: '352b9242-afae-4dee-bd84-2d5cfd58b4e1',
                    marketingActivityItemCategoryCode: 'A0102',
                    marketingActivityItemCategoryName: 'Radio',
                    parentMarketingActivityItemCategoryId: '1ac0e64b-5458-4e92-83a4-9760175e5147',
                    parentMarketingActivityItemCategoryCode: 'A01',
                    parentMarketingActivityItemCategoryName: 'AD',
                    item: '测试项目003',
                    amount: 30,
                    remark: '测试项目备注003'
                }
            ],
            resultDetails: [
                {
                    id: 'string',
                    approverName: 'string',
                    approveTime: '2020-05-18T05:49:48.705Z',
                    approveResult: '1212',
                    approveComment: 'string'
                }
            ]
        }
    });
});

router.put('/:id', (req, res) => {
    res.json(
        {
            message: '修改成功'
        }
    );
});

router.post('/', (req, res) => {
    res.json(
        {
            message: '新增成功'
        }
    );
});

router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废成功'
    });
});

router.put('/:id/approve', (req, res) => {
    res.json({
        message: '审核成功'
    });
});

router.put('/:id/submit', (req, res) => {
    res.json({
        message: '提报成功'
    });
});

router.put('/:id/takeEffect', (req, res) => {
    res.json({
        message: '生效成功'
    });
});
router.put('/:id/pass', (req, res) => {
    res.json({
        message: '通过成功'
    });
});
router.put('/:id/reject', (req, res) => {
    res.json({
        message: '拒绝成功'
    });
});
router.put('/:id/rejectToPrev', (req, res) => {
    res.json({
        message: '驳回成功'
    });
});
module.exports = router;
